package org.mca.mcaweb.util;

import java.io.Serializable;

import org.apache.commons.mail.DefaultAuthenticator;
import org.apache.commons.mail.Email;
import org.apache.commons.mail.EmailException;
import org.apache.commons.mail.HtmlEmail;


public class EmailSendHelper implements Serializable{

	private static final long serialVersionUID = -920382104427412344L;

	public void sendEmail(String toEmail, String toName, String fromEmail, String fromName, String titleEmail, String msgEmail) {

		  
		try { 
			Email email = new HtmlEmail();
			
			email.setHostName("mail.pti.org.br");
			email.addTo(toEmail , toName);
			email.setSmtpPort(587);
			email.setTLS(false);
			email.setFrom(fromEmail, fromName);			  
			email.setAuthenticator(new DefaultAuthenticator("suportecih", "sup0rt3c1h!"));
			email.setSubject(titleEmail);
			email.setMsg(msgEmail);
			  
			email.send();
			
		} catch (EmailException e) {
			e.printStackTrace();
		}
		
	}

}
